import { Dropdown } from 'antd';
import { setLocale } from 'umi';
import styles from '../../styles.less';

import { GlobalOutlined } from '@ant-design/icons';

const index = () => {
  // let targerColor = '#1890ff';

  const onMenuChange = (keys: 'en-US' | 'zh-CN') => {
    setLocale(keys, true);
  };

  // 下拉菜单类型  V4.24.8
  const items = [
    {
      label: (
        <span
          onClick={() => {
            onMenuChange('en-US');
          }}
        >
          English
        </span>
      ),
      key: 'en-US',
    }, // 菜单项务必填写 key
    {
      label: (
        <span
          onClick={() => {
            onMenuChange('zh-CN');
          }}
        >
          简体中文
        </span>
      ),
      key: 'zh-CN',
    },
  ];
  return (
    <Dropdown menu={{ items }} placement="bottomLeft">
      <div className={styles['header-dropDown-layout']}>
        <GlobalOutlined />
      </div>
    </Dropdown>
  );
};

export default index;
